#ifndef _FIG_UI_POPUPANIMATOR_H_
#define _FIG_UI_POPUPANIMATOR_H_

#include "mat_ui_animator.h"

#include "util/delegate.h"
#include "ui/ui_widget.h"


namespace gameflow
{
	class UIPopup;
}

class MATUIPopupAnimator : public MATAnimatedFinishCallBack
{
public:

	MATUIPopupAnimator();

	enum	ANIMATION_TYPE
	{
		ANIMATION_MSGPOPUP,
		ANIMATION_SLIDEFROMRIGHT,
		ANIMATION_SLIDEFROMTOP,

		ANIMATION_C,
	};

	
	
	MATUIPopupAnimator(const std::string& Name,const std::string& CloseButton);
	MATUIPopupAnimator(gameflow::UIPopup* pPopup);
	
	virtual	void					Tick(float dt);  	
	virtual void					Show();
	virtual void					Hide();
	virtual void					OnAnimatedUIFinish(){};
	
	virtual void					OnMouseButtonDown(const math::Vec2& Pos){};
	virtual bool					KeyPressed(input::Keyboard::KEY* pKey){ return false; };
	gameflow::UIPopup*				GetPopup() { return m_pPopup; };


protected:

	   
	gameflow::UIPopup*				m_pPopup;
	ui::UIWidget*					m_pAnimateWidget;
	ANIMATION_TYPE					m_Type;


};

class MATUIPopupAnimatorMgr 
{
public:

	enum	POPUP_NAMES
	{
		POPUP_NAMES_SETTING,
		POPUP_NAMES_PAUSEMENU,
		POPUP_NAMES_MSGBOX,
		POPUP_NAMES_GAMEOVER,
		POPUP_NAMES_ACHIEVEMENT,
		POPUP_NAMES_YESNO,
		POPUP_NAMES_ACHIEVEMENTGAIN,

		POPUP_NAMES_C,
	};

	~MATUIPopupAnimatorMgr();
	static MATUIPopupAnimatorMgr&				Instance();
    void										Tick(float dt);
	MATUIPopupAnimator*							Show(POPUP_NAMES Name);
	MATUIPopupAnimator*							GetPopup(POPUP_NAMES Name);
	void										AddPopupAnimator(POPUP_NAMES Name,MATUIPopupAnimator* pPopupAnimator );
	void										OnMouseButtonDown(const math::Vec2& Pos);
	bool										KeyPressed(input::Keyboard::KEY* pKey);

protected:

	MATUIPopupAnimatorMgr();
	

	MATUIPopupAnimator*							m_pPopups[POPUP_NAMES_C];
	

};


#endif //_PVI_UI_WRAPPER_H_